﻿using System;

namespace Ops.Mpc.ValidationServices.Attributes
{
    [AttributeUsage(AttributeTargets.Property)]
    public class RequiredDateTimeAttribute : ValidationAttribute
    {
        public override bool Validate(object container, object data, string[] propertyNames)
        {
            DateTime? dateTime = data as DateTime?;

            return dateTime.HasValue && dateTime != DateTime.MaxValue && dateTime != DateTime.MinValue;
           
        }
    }
}
